package com.cn.parallel.task;

import java.util.Date;

import com.cn.parallel.task.AbstractTask;

public class MyTask extends AbstractTask<ResultInfo> {

	public ResultInfo execute() throws Exception {
		String taskId = String.valueOf(Thread.currentThread().getId());
		String taskName = Thread.currentThread().getName();
		ResultInfo result = new ResultInfo(taskId, taskName);
		result.setStartTime(new Date());
		System.out.println("running thread id = " + taskId + " name = " + taskName);
		// 模拟业务需要处理1秒.
		try {
			Thread.sleep(5000);
		} catch (InterruptedException e) {
		}
		result.setEndTime(new Date());
		return result;
	}

}